function [ h, a] = learn( hip, ins, attr )

    ACTIVE=1;
    INACTIVE=0;
    ANY='?';
    
    for k=1:size(attr,2)
        
        name=attr(k).name;
        
        m=findIndex(attr(k).options,ins.(name));    % lo marco en los attributos
        attr(k).ocurrens(m)=ACTIVE;                 % si todos los posibles valores de los attributos
            
        if(~strcmp(ins.(name),hip.(name)))          % si no es satisfecha por h

            if(isempty(hip.(name)))
                hip.(name)=ins.(name);
            else
              if(isempty(find(attr(k).ocurrens==INACTIVE, 1)))
                % ya han sido checkeados, entonces poner un '?' 
                hip.(name)=ANY;
              end
            end
        end
    end
    
    % return new hypothesis & attributes ocurrens
    h=hip;
    a=attr;

end

function i=findIndex(options,instance)
    
    for j=1:size(options,2)
        if(strcmp(options(j),instance))
            i=j;
            break;
        end
    end 
end